﻿using AkazoNobel.Scheduler.StoreMasterData.Common;
using AkazoNobel.Scheduler.StoreMasterData.DataAccess.Model;
using AkazoNobel.Scheduler.StoreMasterData.DataAccess.Service;
using AkazoNobel.Scheduler.StoreMasterData.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AkazoNobel.Scheduler.StoreMasterData.Test
{
    /// <summary>
    /// CRM同步任务中的所有方法单元测试
    /// </summary>
    [TestClass()]
    public class CRMDataSyncTest
    {
        /// <summary>
        /// GetCrmSyncList方法单元测试
        /// </summary>
        [TestMethod()]
        public void GetSyncList()
        {
            CRMDataSync sync = new CRMDataSync();
            var syncList = sync.GetCrmSyncList();
            Assert.IsTrue(syncList.Count > 0);
        }

        /// <summary>
        /// PostDataToCrm单元测试
        /// </summary>
        [TestMethod()]
        public void PostDataToCrm()
        {
            List<CrmSyncModel> syncList = new List<CrmSyncModel>();
            CRMDataSync sync = new CRMDataSync();
            syncList = CrmSyncService.GetSyncList();
            HttpResult result = sync.PostDataToCrm(syncList);
            Assert.IsTrue(result.StatusCode == System.Net.HttpStatusCode.OK);
        }

        [TestMethod()]
        public void ExecuteTask()
        {
            CRMDataSync sync = new CRMDataSync();
            sync.ExecuteTask(null);
        }
    }
}
